package pikes.ecma;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

public class ReturnTestCase {
	private MockSyntaxTreeVisitor syntaxTreeVisitor = null;

	@Before
	public void setup() {
		syntaxTreeVisitor = new MockSyntaxTreeVisitor();
	}

	@Test
	public void testReturn() throws Exception {
		MockIExpression expression = new MockIExpression();

		ReturnStatement returnSt = new ReturnStatement(expression);
		returnSt.visit(syntaxTreeVisitor);

		Assert.assertTrue(syntaxTreeVisitor.isReturn);
		Assert.assertTrue(syntaxTreeVisitor.isWhiteSpace);
		Assert.assertSame(syntaxTreeVisitor, expression.syntaxTreeVisitor);
		Assert.assertTrue(syntaxTreeVisitor.isEndOfStatement);
	}
}
